<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        class Father {
            constructor(money, cars, house, company) {
                this.money = money;
                this.cars = cars;
                this.house = house;
                this.company = company;
            }
            talk() {
                console.log(`我有${this.money}元钱,${this.cars}辆车,${this.house}套房子,${this.company}家公司`);
            }
            getMoney() {
                return this.money
            }
            setMoney(newMoney) {
                this.money = newMoney
            }
            getCars() {
                return this.cars
            }
            setCar(newCars) {
                this.cars = newCars
            }
        }


        class Son extends Father {
            constructor(money, cars, house, company) {
                super(money, cars, house, company)
            }
        }
        son = new Son(100, 0, 1, 1)
        son.talk()
        console.log(son);
    </script>
</body>
</html>